<template>
  <view class="global-mask">
    <image :src="loadingIcon" style="width: 16px;height:16px" />
    <text>加载中...</text>
  </view>
</template>
<script>
  import config from '@/config';

  export default {
    computed: {
      loadingIcon() {
        return config.baseImgUrl + '/loading.gif';
      }
    }
  }
</script>
<style lang="scss" scoped>
  .global-mask {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 999;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: rgba(0, 0, 0, 0.1);

    text {
      text-indent: 2px;
    }

    uni-icons {
      animation: rotates 2s linear infinite;
    }
  }

  @keyframes rotates {
    0% {
      -webkit-transform: rotate(0deg);
    }

    30% {
      -webkit-transform: rotate(100deg);
    }

    50% {
      -webkit-transform: rotate(180deg);
    }

    70% {
      -webkit-transform: rotate(270deg);
    }

    100% {
      -webkit-transform: rotate(360deg);
    }
  }
</style>